const path = require('path');
//var CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
    entry: './lib/index.ts',
    devtool: 'source-map',//'inline-source-map',
    mode: 'development', // 设置mode
    module: {
        // unknownContextCritical : false,
        rules: [
            {
                test: /\.ts?$/,
                use: 'ts-loader',
                exclude: /node_modules/
            }
            , {
                parser: { amd: false }
            }
        ]
    },
    resolve: {
        extensions: ['.ts', '.js']
    },
    output: {
        filename: 'ping-pang-game.js',
        path: path.resolve(__dirname, 'dist'),
        libraryTarget: 'umd',
        umdNamedDefine: true
        //libraryExport: "default",
        , library: "PingPangGame"   //不要设置libraryName就行了
    },
    devServer: {
        //contentBase: path.join(__dirname, "dist"),
        contentBase: path.join(__dirname),
        port: 7000,
        // publicPath:'/',
        // overlay: true,
        host: '127.0.0.1',
        progress: true
    },
    plugins: [
        // new CopyWebpackPlugin([ // 复制插件
        //     {
        //         from: path.join(__dirname, 'src/assets'),
        //         to: path.join(__dirname, 'dist/assets')
        //     }
        // ])
    ]
};